我正在尝试使用特定的日期范围以及其他标准来读取Outlook中的电子邮件-发件人、主题等。但是,我不确定如何指定Python可以搜索电子邮件的日期范围。这就是我目前所知道的,它产生了下面的类型错误: if subject in message.subject and date in message.senton.date():
TypeError: argument of type 'datetime.date' is not iterableimport win32com.client
import datetime
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(18).Folders.Item("xxxxx")
messages = inbox.Items
date = datetime.date.today()
subject = "xxxxxxx"
for message in messages:
if subject in message.subject and date in message.senton.date():
print(message.senton.time())我想搜索特定日期范围内的电子邮件,以及能够使用多个标准进行搜索。例如,指定主题以及发送者等,但我不确定如何,我是新的Python,所以请帮助!
|